/**
 * login模块接口列表
 */

import base from '@/common/base'; // 导入接口域名列表
import axios from '@/common/http'; // 导入http中创建的axios实例
import qs from 'qs'; // 根据需求是否导入qs模块

const index = {
    // 注册
    getAd(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Index/getAd`,
            data: qs.stringify(params),
            headers: {'user': 1}
        });
    },

    // 注册
    getData() {
        return axios({
            method: 'post',
            url: `${base.sq}Index/index`,
            data: [],
            headers: {'user': 1}
        });
    },

    // 注册
    getRecommend(page) {
        return axios({
            method: 'get',
            url: `${base.sq}Index/recommend`,
            params: {page: page},
            headers: {'user': 1,'load':1}
        });
    },

    //搜索页热门搜索
    getHotKey() {
        return axios({
            method: 'get',
            url: `${base.sq}Index/searchKeyWord`,
            params: {},
            headers: {'user': 1}
        });
    },

    /**
     * 获取客服信息
     */
    getServer() {
        return axios({
            method: 'get',
            url: `${base.sq}Index/getServer`,
            headers: {'user': 1}
        });
    },

    /**
     * 获取系统信息
     * @param page
     */
    getSysMsg(page) {
        return axios({
            method: 'get',
            url: `${base.sq}Index/getSysMsg`,
            params: {page: page}
        });
    },

    // 注册
    shares(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Index/share`,
            data: qs.stringify(params),
            headers: {'user': 1}
        });
    },

    toBase64(params){
        return axios({
            method: 'post',
            url: `${base.sq}Index/toBase64`,
            data: qs.stringify(params),
            headers: {'user': 1}
        });
    },

    userUpload(params){
        return axios({
            method: 'post',
            url: `${base.sq}Index/userUpload`,
            data: params,
            headers: {'user': 1,'load':1,'Content-Type': 'multipart/form-data'}
        });
    },

    //检测版本
    checkV(){
        return axios({
            method: 'post',
            url: `${base.sq}Index/checkV`,
            headers: {'user': 1,'load':1}
        });
    }
}

export default index;
